#!/usr/bin/python
#coding=utf-8 
from __future__ import division
import os
def virtual_memory():
    total,used,free,shared,buffers,cached =os.popen("free").read().split("\n")[1].split()[1:]
    percent = '%.2f'%(int(used) / int(total) * 100)        
    return 'mem_total:{0},mem_used:{1},mem_percent:{2}%,mem_free:{3}'.format(total,used,percent,free)
def swap_memory():
    total,used,free =os.popen("free").read().split("\n")[3].split()[1:]
    percent = '%.2f'%(int(used) / int(total) * 100)        
    return 'swap_total:{0},swap_used:{1},swap_percent:{2}%,swap_free:{3}'.format(total,used,percent,free)
if __name__ == '__main__':
    swap_memory()
    virtual_memory()

